Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

array-includes

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-includes

A spec-compliant `Array.prototype.includes` shim/polyfill/replacement that works as far down as ES3.

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16M
decreased by-41.87%
Maintainers
1
Weekly downloads
 
Created

What is array-includes?

The array-includes npm package provides a simple utility function for checking if an array includes a certain element, with optional support for the fromIndex parameter. It is a polyfill for the Array.prototype.includes method, which is part of the ECMAScript 2016 (ES7) standard but may not be available in all environments.

What are array-includes's main functionalities?

Check if an array includes a specific element

This feature allows you to check if an array contains a specific element. It returns true if the element is found, otherwise false.

var arrayIncludes = require('array-includes');
var myArray = [1, 2, 3];
var includesTwo = arrayIncludes(myArray, 2); // true

Check if an array includes a specific element starting from a given index

This feature allows you to check if an array contains a specific element, starting the search from a given index. It is useful when you want to ignore certain elements at the beginning of the array.

var arrayIncludes = require('array-includes');
var myArray = [1, 2, 3, 2];
var includesTwoFromIndex2 = arrayIncludes(myArray, 2, 2); // true

Other packages similar to array-includes

Keywords

FAQs

Package last updated on 24 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc